{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "A linear model in the presence of outliers"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x6e70d30>]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAEACAYAAABfxaZOAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAEg1JREFUeJzt3X+snXV9wPH3RxjZ1I0yMyBSQRamFlN0ZGNuZPEWFMEl\nYPYHwZilsJIs7ZxkW+Zt/afNskRZYheTlUQjJcToEF0crTHawfFmcYuiQ6Ta2jVxVezkmjmH9y5g\nQT/74zyHPr3c23vuueec59f7lTQ597nnx3Oe3nzv+37P9zwnMhNJUje8pOodkCRNj4O+JHWIg74k\ndYiDviR1iIO+JHWIg74kdciqg35EbIyIXkR8KyIOR8R7iu0XRMShiDgWEV+IiPNLt9kVEccj4mhE\n3DDJJyBJGl6stk4/Ii4GLs7MxyPi5cC/A7cAdwA/ysy/jYhZ4ILM3BkRVwIfB34b2Ag8DPxG+oYA\nSarcqqWfmU9l5uPF5UXgKP3B/Bbg/uJq9wPvKC7fDDyQmc9n5gngOHDNmPdbkjSCNc3pR8SrgTcC\nXwYuysx56P9iAC4srnYJ8GTpZieLbZKkig096BdTO58G7iqKf+l0jdM3klRz5w5zpYg4l/6A/7HM\nfKjYPB8RF2XmfDHv/8Ni+0ngVaWbbyy2Lb1Pf0lI0ggyM0a97bClvx84kpkfKm07ANxeXN4KPFT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cXkr8NDSG7VJZr4vMy/N\nzF+n/zPQy8w/Ag7SoeMwUPzp/mREvKbYdD3wLTr2c0F/WudNEfGLxQuS19N/ob9rxyE48y/glZ7/\nAeC2YoXT5cAV9N8Mu/IdV7FOPyJupL9SYfDGrQ9MfScqEhHXAv8CHKb/J1oC76P/H/Ug/d/a3wVu\nzcz/rWo/pyki3gz8ZWbeHBG/SnePwxvov6j9C8B3gDvov6jZqeMREbvph8BzwNeBO4FfpiPHISI+\nAcwArwDmgd3APwGfYpnnHxG7gG30j9ddmXnorPfvm7MkqTt8IVeSOsRBX5I6xEFfkjrEQV+SOsRB\nX5I6xEFfkjrEQV+SOsRBX5I65P8Bv3GahHmpUK4AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x6fabb00>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "num_points = 100\n",
    "x_vals = np.arange(num_points)\n",
    "y_truth = 2 * x_vals\n",
    "plt.plot(x_vals, y_truth)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0x7286a58>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZMAAAEKCAYAAADXdbjqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAH7ZJREFUeJzt3XucX3V95/HXm2AWWy5yWZJtIohCaqTeYg20YpmCCNQW\n0sdySbeWWLO2K7Ria10Ttc6wthvEtkRbodsuyqXVFGhXok1DuGSsulxbFTRopnVBEi5WAmmtXWWG\nd/843yEnP2ZyO/Ob+V3ez8djHnPO59y+v5P8fp/53s5PtomIiGhiv5kuQEREdL8kk4iIaCzJJCIi\nGksyiYiIxpJMIiKisSSTiIhoLMkkeoKkdZJ+qdPPuYfXP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ABJRU5E\nrkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7021470>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "y_noisy = y_truth.copy()\n",
    "#Change y-values of some points in the line\n",
    "y_noisy[20:40] = y_noisy[20:40] * (-4 * x_vals[20:40]) - 100\n",
    "\n",
    "plt.title(\"Noise in y-direction\")\n",
    "plt.xlim([0,100])\n",
    "plt.scatter(x_vals, y_noisy,marker='x')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('OLS ', 'R-squared: ', -904.75656218367101, 'Mean Absolute Error', 1480.9397011701167)\n",
      "('TSR ', 'R-squared: ', 0.99999999992653421, 'Mean Absolute Error', 0.00044250338457484898)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0xa466be0>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYwAAAEACAYAAACgS0HpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl8VNX9//HXJ4EEEojgD0GLrGIE3PFbxGol1rpgFdQq\n4o5QF9BWW7UC1oLUtohVqWu/tVqXglStX6UuFERia1UWEdkXiyC7VXYCIcvn98e5xBECBmaSmWTe\nz8djHrlz7r0zn7lJ7mfuOfecY+6OiIjIN8lIdgAiIlI7KGGIiEiVKGGIiEiVKGGIiEiVKGGIiEiV\nKGGIiEiVVHvCMLOlZvaxmX1kZlOjsqZmNsHMFprZP8zsgJjtB5vZYjObb2ZnVnd8IiJSNTVxhVEO\nFLj78e7eNSobBLzl7kcAbwODAcysM9Ab6AT0AB4zM6uBGEVE5BvURMKwSt6nF/BMtPwMcH603BMY\n6+6l7r4UWAx0RUREkq4mEoYDE81sm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hC8RJcBHwI+AxqTBsTCzMUAB8P+AtYTp\nJl4BXqSSz25mgwnTSpQQqrgnfON71LaEISIiyVHbqqRERCRJlDBERKRKlDBERKRKlDBERKRKlDBE\nRKRKlDBERKRKlDBERKRKlDBERKRK/j90ycZDh1H7oAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0xa0c3cc0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from sklearn.linear_model import LinearRegression, TheilSenRegressor\n",
    "from sklearn.metrics import r2_score, mean_absolute_error\n",
    "\n",
    "named_estimators = [('OLS ', LinearRegression()), ('TSR ', TheilSenRegressor())]\n",
    "\n",
    "for num_index, est in enumerate(named_estimators):\n",
    "    y_pred = est[1].fit(x_vals.reshape(-1, 1),y_noisy).predict(x_vals.reshape(-1, 1))\n",
    "    print (est[0], \"R-squared: \", r2_score(y_truth, y_pred), \"Mean Absolute Error\", mean_absolute_error(y_truth, y_pred))\n",
    "    plt.plot(x_vals, y_pred, label=est[0])\n",
    "plt.plot(x_vals, y_truth, label='True line')\n",
    "plt.legend(loc='upper left')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0xab77f98>"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZMAAAEKCAYAAADXdbjqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XmcFNW5//HP042g4AAiAgqCIGBwwe2KuDIuRDSJYFTE\nREHll+SKSTQ7aK4z3iyYqBFN1JvkYtwlaryKURFRJpG4oYkBg7Kog+zKLhCR6Xp+f1QNU9PMsPX0\n9PZ9v179mupTp6pOFzP9cOqcp8rcHRERkUwkct0AEREpfAomIiKSMQUTERHJmIK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2CDCHMNN2jNd90quoPzV4Sjbb\nLiIiOy+rwcTd/wY09ryFMxvZZjwN3OjO3d8kTAATEZE8owz4IlVeXp7rJuQNnYs6Ohd1dC6aVlE9\nttfMvJg+j4hIczAzPMMB+GbLM8mlgw46iIULd3RX79LUo0cPqqurc90MESlwJdEziaJuDlqU/3Ru\nRKQpeiYaMxERkYwpmIiISMYUTEREJGMKJiIikjEFkzxxzz330L9/f9q0acMBBxzAmDFjWLdu3db1\nN9xwA5deemmD286YMYOTTjqJ9u3b07FjR0455RTefPPN5mq6iIiCST645ZZbGDduHLfccgvr16/n\n1VdfZeHChQwePJiampqt9Rp6VPcnn3zCl770Ja6++mrWrFnDkiVLqKiooFWrVs35EUSkxCmY5Ngn\nn3xCZWUlv/nNbxg8eDDJZJLu3bvzyCOPUF1dzQMPPLDd7efNm4eZMXz4cMyMVq1aceaZZ3L44Yc3\n0ycQEVEwybmXX36ZzZs3c95559Urb9OmDeeccw7PP//8drfv27cvyWSSyy67jClTprB27dpsNldE\npEEKJhGzpnntqpUrV9KxY0cSiW3/Kfbff39Wrly53e3LysqYMWMGiUSCr3/963Tq1ImhQ4fy8ccf\n73pjRER2k4JJxL1pXruqY8eOrFy5kiAItlm3bNkyOnbsuMN9HHLIIdx99918+OGHvP322yxdupRr\nrrlm1xsjIrKbFExy7IQTTqBVq1Y8/vjj9co3bNjAs88+y5lnNnin/kb17duXyy67jLfffrspmyki\nsl0KJjnWtm1brr/+er71rW/x3HPPUVNTQ3V1NRdddBHdu3fnkksu2Vo3lUqxefPmra/PPvuMuXPn\n8qtf/YolS8KnGC9atIiHH36YE044IVcfSURKkIJJHvjBD37Az3/+c77//e/Trl07TjjhBHr06MG0\nadPYY489ttabNGkSrVu3pnXr1uy111707t2btm3b8tprr3H88cdTVlbGiSeeSP/+/bn55ptz+IlE\npNTorsElTudGRHTXYBEpHqlU/eXa9/FlgM8+U70M9xFsSdUVxetloKCCiZkNMbN3zWyemf0o1+2R\nPJf+R1IAf+QlXe+k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<matplotlib.figure.Figure at 0xa8ce6a0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "for num_index, est in enumerate(named_estimators):\n",
    "    y_pred = est[1].fit(x_vals.reshape(-1, 1),y_noisy).predict(x_vals.reshape(-1, 1))\n",
    "    plt.plot(x_vals, y_pred, label=est[0])\n",
    "plt.legend(loc='upper left')\n",
    "plt.title(\"Noise in y-direction\")\n",
    "plt.xlim([0,100])\n",
    "plt.scatter(x_vals, y_noisy,marker='x', color='red')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('OLS ', 'R-squared: ', -904.75656218367101, 'Mean Absolute Error', 1480.9397011701167)\n",
      "('Ridge ', 'R-squared: ', -904.75016045386951, 'Mean Absolute Error', 1480.9385250222022)\n",
      "('TSR ', 'R-squared: ', 0.99999999992653421, 'Mean Absolute Error', 0.00044250338457484898)\n",
      "('RANSAC', 'R-squared: ', 1.0, 'Mean Absolute Error', 1.0236256287043944e-14)\n",
      "('ENet ', 'R-squared: ', -904.4272711687513, 'Mean Absolute Error', 1480.8791832083955)\n",
      "('Huber ', 'R-squared: ', 0.99999998674708135, 'Mean Absolute Error', 0.0066449565546700517)\n"
     ]
    }
   ],
   "source": [
    "from sklearn.linear_model import Ridge, LinearRegression, TheilSenRegressor, RANSACRegressor, ElasticNet, HuberRegressor\n",
    "from sklearn.metrics import r2_score, mean_absolute_error\n",
    "named_estimators = [('OLS ', LinearRegression()),('Ridge ', Ridge()),('TSR ', TheilSenRegressor()),('RANSAC', RANSACRegressor()),('ENet ',ElasticNet()),('Huber ',HuberRegressor())]\n",
    "for num_index, est in enumerate(named_estimators):\n",
    "    y_pred = est[1].fit(x_vals.reshape(-1, 1),y_noisy).predict(x_vals.reshape(-1, 1))\n",
    "    print (est[0], \"R-squared: \", r2_score(y_truth, y_pred), \"Mean Absolute Error\", mean_absolute_error(y_truth, y_pred))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
